package com.lh.lock;

import org.openjdk.jol.info.ClassLayout;
import org.openjdk.jol.vm.VM;

class MyObject{

    int i = 127;
    boolean flag = false;
}

public class ObjectHeadTest {

    public static void main(String[] args) {

        VM();
        System.out.println("----------------------------------------");

        //引入JOL，直接使用
        System.out.println(ClassLayout.parseInstance(new MyObjectTest()).toPrintable());

    }

    private static void VM() {
        //VM的细节详细情况
        System.out.println(VM.current().details());

        //所有的对象分配的字节都是8的整数倍
        System.out.println(VM.current().objectAlignment());
    }
}
